public class Main8 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int w=scanner.nextInt();
        int m=scanner.nextInt();
        int n=scanner.nextInt();
        int[][] list=new int[10006/w][w];
        int num=1;

        for (int i=0;i<10006/w;i++){
            if(i%2==0){
                for (int j=0;j<w;j++){
                    list[i][j]=num;
                    num++;
                }
            }else{
                for (int j=w-1;j>=0;j--){
                    list[i][j]=num;
                    num++;
                }

            }
        }
        int mi=0;
        int mj=0;
        int ni=0;
        int nj=0;
        for(int i=0;i<10006/w;i++){
            for(int j=0;j<w;j++){
                if(list[i][j]==m){
                    mi=i;
                    mj=j;
                }
                if(list[i][j]==n){
                    ni=i;
                    nj=j;
                }
            }
        }

        System.out.println("--------------");
        System.out.println(Math.abs(mi-ni)+Math.abs(mj-nj));
        System.out.println("--------------");

